package net.hashcoding.cookbook.core;

/**
 * Created by Administrator on 2017/6/25.
 */
public class ServiceException extends RuntimeException {

    private int code;
    private String verbose;

    public static ServiceException notFound() {
        return new ServiceException(404, "not found");
    }

    public static ServiceException parametersError() {
        return new ServiceException(412, "parameters error");
    }

    public static ServiceException requestError() {
        return new ServiceException(400, "request error");
    }

    public static ServiceException notAccepted() {
        return new ServiceException(406, "not accepted");
    }

    public static ServiceException internalError() {
        return new ServiceException(500, "internal error");
    }

    public ServiceException(int code, String verbose) {
        this.code = code;
        this.verbose = verbose;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getVerbose() {
        return verbose;
    }

    public void setVerbose(String verbose) {
        this.verbose = verbose;
    }
}
